<?
class UploadC{

 var $fileName="";
 var $fileType="";
 var $upPath="";
 var $upName=""; 
 var $sizeF=false;
 var $fileSize=0;// file size upload
 var $fileSize1=0;// default
 var $com=false; //all file type
 var $fileT;//tmp_name
 var $fullpath="";
 function UploadC(){  
  $this->fileType=""; 
  $this->upPath="";
  $this->upName="";
 }  
 function getImageExtension() {	
	
	if ($this->fileType == "image/pjpeg") {
		return ".jpg";
	} elseif ($this->fileType == "image/gif") {
		return ".gif";
	}else{
		return 0;
	}
 }
 function fileSize(){
   if($this->sizeF==true){
		if($this->fileSize1>=$this->fileSize){
		 return $this->fileSize;
		} else{
		 return 0;
		}   
   } 
   return 1;
}
 function Upload(){ 
   $path=$this->upPath.$this->upName;
   if($this->fileSize()){   
	   if($this->com==true){	
	     $path=$this->upPath.$this->fileName;		
		 move_uploaded_file($this->fileT,$path);
		 return $this->fileName;
	   }	   
	   if($exe=$this->getImageExtension()){
		 $path.=$exe;
		 move_uploaded_file($this->fileT,$path);
		 return $this->upName.$exe;
       }
	 }  
     return 0;	 
  }
   function DeleteFile(){
   if(file_exists($this->fullpath)){
    unlink($this->fullpath);
	return 1;
   }
  return 0;  
  } 
}//end class

?>